package com.chixing.day05.homework;

import java.util.Scanner;

/**
 * @author Y2014188432
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(getResult(n));
    }
    public static int getResult(int n){
        if(n <= 6){
            return n;
        }
        int[] result = new int[n];
        result[0] = 1;
        int a = 0;
        int b = 0;
        int c = 0;
        for (int i = 1; i < n; i++) {
            result[i] = getMin(2*result[a],3*result[b],5*result[c]);
            if(result[i] == 2*result[a]){ a += 1;}
            if(result[i] == 3*result[b]){ b += 1;}
            if(result[i] == 5*result[c]){ c += 1;}
        }
        return result[n - 1];
    }

    public static int getMin(int a,int b,int c){
        return Math.min(Math.min(a,b),c);
    }
}
